package org.huawei260.basic.part_3_tree.Heap;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

/**
 * @Author: qingle
 * @Date: 2024/11/29-16:03
 * @Description:
 * @Version: 1.0
 */
public class FileGenerator {
	public static void main(String[] args) throws IOException {
		BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("ids.txt"));
		Random random = new Random();

		int count = 0;
		while (count < 10_000_000) { // 假设每行包含8位数字，100MB文件大约包含12,500,000行
			String id = String.format(count + ":" + "%08d", random.nextInt(10_000_000));
			bufferedWriter.write(id);
			bufferedWriter.newLine();
			count++;
		}

		bufferedWriter.close();
		System.out.println("文件生成完毕！");

	}
}
